package com.google.android.gms.internal;

import com.google.android.gms.internal.zzdus;
import com.google.android.gms.internal.zzdwc;
import com.google.android.gms.internal.zzfhu;
import java.io.IOException;

public final class zzduo extends zzfhu<zzduo, zza> implements zzfje {
    private static volatile zzfjl<zzduo> zzbbm;
    /* access modifiers changed from: private */
    public static final zzduo zzmfy;
    private zzdus zzmfw;
    private zzdwc zzmfx;

    public static final class zza extends zzfhu.zza<zzduo, zza> implements zzfje {
        private zza() {
            super(zzduo.zzmfy);
        }

        /* synthetic */ zza(zzdup zzdup) {
            this();
        }
    }

    static {
        zzduo zzduo = new zzduo();
        zzmfy = zzduo;
        zzduo.zza(zzfhu.zzg.zzppw, (Object) null, (Object) null);
        zzduo.zzpph.zzbkr();
    }

    private zzduo() {
    }

    public static zzduo zzj(zzfgs zzfgs) throws zzfie {
        return (zzduo) zzfhu.zza(zzmfy, zzfgs);
    }

    /* access modifiers changed from: protected */
    public final Object zza(int i, Object obj, Object obj2) {
        zzdus.zza zza2;
        zzdwc.zza zza3;
        switch (zzdup.zzbbk[i - 1]) {
            case 1:
                return new zzduo();
            case 2:
                return zzmfy;
            case 3:
                return null;
            case 4:
                return new zza((zzdup) null);
            case 5:
                zzfhu.zzh zzh = (zzfhu.zzh) obj;
                zzduo zzduo = (zzduo) obj2;
                this.zzmfw = (zzdus) zzh.zza(this.zzmfw, zzduo.zzmfw);
                this.zzmfx = (zzdwc) zzh.zza(this.zzmfx, zzduo.zzmfx);
                return this;
            case 6:
                zzfhb zzfhb = (zzfhb) obj;
                zzfhm zzfhm = (zzfhm) obj2;
                if (zzfhm != null) {
                    boolean z = false;
                    while (!z) {
                        try {
                            int zzcxx = zzfhb.zzcxx();
                            if (zzcxx != 0) {
                                if (zzcxx == 10) {
                                    if (this.zzmfw != null) {
                                        zzdus zzdus = this.zzmfw;
                                        zzfhu.zza zza4 = (zzfhu.zza) zzdus.zza(zzfhu.zzg.zzppy, (Object) null, (Object) null);
                                        zza4.zza(zzdus);
                                        zza2 = (zzdus.zza) zza4;
                                    } else {
                                        zza2 = null;
                                    }
                                    this.zzmfw = (zzdus) zzfhb.zza(zzdus.zzbox(), zzfhm);
                                    if (zza2 != null) {
                                        zza2.zza(this.zzmfw);
                                        this.zzmfw = (zzdus) zza2.zzczw();
                                    }
                                } else if (zzcxx == 18) {
                                    if (this.zzmfx != null) {
                                        zzdwc zzdwc = this.zzmfx;
                                        zzfhu.zza zza5 = (zzfhu.zza) zzdwc.zza(zzfhu.zzg.zzppy, (Object) null, (Object) null);
                                        zza5.zza(zzdwc);
                                        zza3 = (zzdwc.zza) zza5;
                                    } else {
                                        zza3 = null;
                                    }
                                    this.zzmfx = (zzdwc) zzfhb.zza(zzdwc.zzbqo(), zzfhm);
                                    if (zza3 != null) {
                                        zza3.zza(this.zzmfx);
                                        this.zzmfx = (zzdwc) zza3.zzczw();
                                    }
                                } else if (!zza(zzcxx, zzfhb)) {
                                }
                            }
                            z = true;
                        } catch (zzfie e) {
                            throw new RuntimeException(e.zzi(this));
                        } catch (IOException e2) {
                            throw new RuntimeException(new zzfie(e2.getMessage()).zzi(this));
                        }
                    }
                    break;
                } else {
                    throw new NullPointerException();
                }
            case 7:
                break;
            case 8:
                if (zzbbm == null) {
                    synchronized (zzduo.class) {
                        if (zzbbm == null) {
                            zzbbm = new zzfhu.zzb(zzmfy);
                        }
                    }
                }
                return zzbbm;
            case 9:
                return (byte) 1;
            case 10:
                return null;
            default:
                throw new UnsupportedOperationException();
        }
        return zzmfy;
    }

    public final void zza(zzfhg zzfhg) throws IOException {
        if (this.zzmfw != null) {
            zzfhg.zza(1, (zzfjc) this.zzmfw == null ? zzdus.zzbox() : this.zzmfw);
        }
        if (this.zzmfx != null) {
            zzfhg.zza(2, (zzfjc) this.zzmfx == null ? zzdwc.zzbqo() : this.zzmfx);
        }
        this.zzpph.zza(zzfhg);
    }

    public final zzdus zzbop() {
        return this.zzmfw == null ? zzdus.zzbox() : this.zzmfw;
    }

    public final zzdwc zzboq() {
        return this.zzmfx == null ? zzdwc.zzbqo() : this.zzmfx;
    }

    public final int zzhs() {
        int i = this.zzppi;
        if (i != -1) {
            return i;
        }
        int i2 = 0;
        if (this.zzmfw != null) {
            i2 = 0 + zzfhg.zzc(1, (zzfjc) this.zzmfw == null ? zzdus.zzbox() : this.zzmfw);
        }
        if (this.zzmfx != null) {
            i2 += zzfhg.zzc(2, (zzfjc) this.zzmfx == null ? zzdwc.zzbqo() : this.zzmfx);
        }
        int zzhs = i2 + this.zzpph.zzhs();
        this.zzppi = zzhs;
        return zzhs;
    }
}
